package com.uzai.common.enums.notice;

import java.util.Objects;

/**
 * The enum Notice business type enum.
 *
 * @author mingyang.chen create in 2023/7/13 11:00
 */
public enum NoticeBusinessTypeEnum {

    /**
     * Order notice notice business type enum.
     */
    order_notice(1, "订单通知"),
    /**
     * First order reward notice notice business type enum.
     */
    first_order_reward_notice(2, "首次下单奖励通知"),

    app_goods_gift_money(3, "APP_商品兑换淘礼金"),
    ;

    private final Integer code;

    private final String desc;

    NoticeBusinessTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * Gets code.
     *
     * @return the code
     */
    public Integer getCode() {
        return code;
    }

    /**
     * Gets desc.
     *
     * @return the desc
     */
    public String getDesc() {
        return desc;
    }

    /**
     * Gets by code.
     *
     * @param code the code
     * @return the by code
     */
    public static NoticeBusinessTypeEnum getByCode(Integer code) {
        for (NoticeBusinessTypeEnum value : NoticeBusinessTypeEnum.values()) {
            if (Objects.equals(value.code, code)) {
                return value;
            }
        }
        return null;
    }
}
